<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ include file="/common/common.jsp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
	<script type="text/javascript" language="javascript" src="../js/md5.js"></script>
	<script language="javascript" src="../js/DatePicker/WdatePicker.js" type="text/javascript"></script>
	<script type="text/javascript" language="javascript">
		function getPwd() {
 			var pwd = document.getElementById("pwd");
 			var old_pwd = $('old_password');
 			//alert(old_pwd.value);
 			pwd.value = hex_md5(pwd.value);
 			old_pwd.value = hex_md5(old_pwd.value);
 			return true;
		}
		
		function check_repassword(){
			var re_password = $('re_pwd').value;
			var password = $('pwd').value;
			
			if(password == ''){
				$('pwd_msg').innerHTML = '密码不能为空！';
				$('pwd_msg').style.display='';
			}
			
			if(re_password == ''){
				$('re_pwd_msg').innerHTML = '密码不能为空！';
				$('re_pwd_msg').style.display='';
			}
			
			if(re_password != password) {
				//alert(re_password);
				//alert(password);
				$('re_pwd_msg').innerHTML = '密码不一致！';
				$('re_pwd_msg').style.display='';
			}else{
				$('re_pwd_msg').style.display='none';
			}
		}
		
		function clear_msg(field){
			var fieldid = field.id;
			$(fieldid).value = '';
			$(fieldid + '_msg').innerHTML = '';
			$(fieldid + '_msg').style.display='none';
		}
		
		function $(fieldid){
			return document.getElementById(fieldid);
		}
	</script>
	</head>
	<body bgcolor="#ccddee" link="#000066" vlink="#0066FF" alink="#99FF00">
		<div>
			<table>
				<tr>
					<td>
						<s:fielderror></s:fielderror>
					</td>
				</tr>
			</table>
		</div>
		<center>
			<s:form method="post" action="updatePersonnelPassword" validate="true" theme="simple"
					onsubmit="return getPwd();">
				<table width="100%" border=1 align="center" cellpadding="0"
					cellspacing="0" bgcolor="#ccddee">
					<tr>
						<td width="15%" align="right">
							旧密码:
						</td>
						<td width="30%" align="left">
							<s:password  id="old_pwd" name="old_password" theme="simple" required="true" onclick="clear_msg(this)"></s:password>
						</td>
						<td align="left">
							<div id="old_pwd_msg" style="background: red;"></div>
						</td>
					</tr>
					<tr>
						<td width="15%" align="right">
							新密码:
						</td>
						<td width="30%" align="left">
							<s:password  id="pwd" name="personnel.password" theme="simple" required="true" onclick="clear_msg(this)" onblur="check_repassword()"></s:password>
						</td>
						<td align="left">
							<div id="pwd_msg" ></div>
						</td>
					</tr>
					<tr id="re_pwd_tr">
						<td width="15%" align="right">
							重复密码:
						</td>
						<td width="30%" align="left">
							<s:password  id="re_pwd" name="password_re" theme="simple" required="true" onclick="clear_msg(this)" onblur="check_repassword()"></s:password>
						</td>
						<td align="left">
							<div id="re_pwd_msg" style="background: red"></div>
						</td>
					</tr>
				</table>
				<br />
				<br />
				<table>
					<tr>
						<td>
							<s:submit value=" 保存密码 " theme="simple" />
						</td>
						<td>
							<s:hidden name="personnel.staffcode" theme="simple" required="true"></s:hidden>
						</td>
					</tr>
				</table>
			</s:form>
		</center>

	</body>
</html>